package com.gitee.wsl.common.ui.base

import androidx.annotation.IntRange
import androidx.compose.ui.graphics.Brush as KBrush
import androidx.compose.ui.graphics.Color as KColor
import com.gitee.wsl.base.Or
import com.gitee.wsl.base.one
import com.gitee.wsl.base.two


//sealed interface ColorOrBrush: Or<Color, Brush> {
//
//    class Color( val value: androidx.compose.ui.graphics.Color): ColorOrBrush{
//        constructor(color: Int):this(androidx.compose.ui.graphics.Color(color))
//    }
//    class Brush( val value:androidx.compose.ui.graphics.Brush): ColorOrBrush
//
//    //companion object
//
//}

//sealed interface ColorOrBrush: Or<KColor, KBrush> {
//    class Color(value: KColor) : Or.One<KColor>(value),
//    class Brush(value: KBrush) : Or.Two<KBrush>(value)
//}

typealias ColorOrBrush = Or<KColor, KBrush>


fun ColorOrBrush.onColor(block:(KColor)->Unit) = one(block)

fun ColorOrBrush.onBrush(block:(KBrush)->Unit) = two(block)

fun KColor.toColorOrBrush():ColorOrBrush = Or.One(this)

fun KBrush.toColorOrBrush(): ColorOrBrush =  Or.Two(this)

fun test(){
    val a = KColor.Black.toColorOrBrush()

}